/*
 * @lc app=leetcode.cn id=2865 lang=csharp
 *
 * [2865] 美丽塔 I
 */

// @lc code=start
public class Solution {
    public long MaximumSumOfHeights(IList<int> maxHeights) {
        var dp = new long[maxHeights.Count];
        dp[0] = 0;
        var max = 0L;
        for (int i = 1; i < maxHeights.Count; i++)
        {
            dp[i] = dp[i - 1] + Math.Abs(maxHeights[i] - maxHeights[i - 1]);
            max = Math.Max(max, dp[i]);
        }
        return max;
    }
}
// @lc code=end

